
<!DOCTYPE html>
<html>
    <head>

        <title>PHP string &quot;contains&quot; - Stack Overflow</title>
        <link rel="shortcut icon" href="//cdn.sstatic.net/stackoverflow/img/favicon.ico">
        <link rel="apple-touch-icon image_src" href="//cdn.sstatic.net/stackoverflow/img/apple-touch-icon.png">
        <link rel="search" type="application/opensearchdescription+xml" title="Stack Overflow" href="/opensearch.xml">
        <meta name="twitter:card" content="summary">
        <meta name="twitter:domain" content="stackoverflow.com"/>
        <meta name="og:type" content="website" />
        <meta name="og:image" content="http://cdn.sstatic.net/stackoverflow/img/apple-touch-icon@2.png?v=fde65a5a78c6"/>
        <meta name="og:title" content="PHP string &quot;contains&quot;" />
        <meta name="og:description" content="
              Possible Duplicate:
              How can I check if a word is contained in another string using PHP?  




              I know you can do this in many different ways like regex or loop through the string to see if it " />
        <meta name="og:url" content="http://stackoverflow.com/questions/13577041/php-string-contains"/>



        <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
        <script src="//cdn.sstatic.net/Js/stub.en.js?v=3a1a88fb5ba5" type="text/javascript"></script>
        <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/stackoverflow/all.css?v=eee059983a6e">

        <script type="text/javascript">
        
            StackExchange.ready(function () {
                StackExchange.using("postValidation", function () {
                    StackExchange.postValidation.initOnBlurAndSubmit($('#post-form'), 2, 'answer');
                });

            
                StackExchange.question.init({showAnswerHelp:true,totalCommentCount:1,shownCommentCount:1,highlightColor:'#F4A83D',backgroundColor:'#FFF',questionId:13577041});

                styleCode();

                StackExchange.realtime.subscribeToQuestion('1', '13577041');
            
            });
        </script>


        <script type="text/javascript">
            StackExchange.init({"locale":"en","stackAuthUrl":"https://stackauth.com","serverTime":1381996263,"styleCode":true,"enableUserHovercards":true,"site":{"name":"Stack Overflow","description":"Q&A for professional and enthusiast programmers","isNoticesTabEnabled":true,"recaptchaPublicKey":"6LdchgIAAAAAAJwGpIzRQSOFaO0pU6s44Xt8aTwc","enableSocialMediaInSharePopup":true},"user":{"fkey":"bbf4aae4744d77cea1137b3503f706d4","isAnonymous":true}});
            StackExchange.using.setCacheBreakers({"js/prettify-full.en.js":"e0bbd4760e83","js/moderator.en.js":"1a411fd265fe","js/full-anon.en.js":"d2d6bfa6e0f2","js/full.en.js":"70679ae5f38a","js/wmd.en.js":"3b1fa237ee0a","js/third-party/jquery.autocomplete.min.js":"e5f01e97f7c3","js/third-party/jquery.autocomplete.min.en.js":"","js/mobile.en.js":"98eaf3ec452d","js/help.en.js":"8891d63dccb3","js/tageditor.en.js":"f18986485d8f","js/tageditornew.en.js":"172e95af9b71","js/inline-tag-editing.en.js":"499a39b24fd2","js/revisions.en.js":"1dead817b481","js/review.en.js":"53b28a79980b","js/tagsuggestions.en.js":"a7d0f3ff530a","js/post-validation.en.js":"46508df60bf9","js/explore-qlist.en.js":"73825bd006fc","js/events.en.js":"130d4e07b47b"});
        </script>
        <script type="text/javascript">
            StackExchange.using("gps", function() {
                StackExchange.gps.init(true);
            });
        </script>

        <script type="text/javascript">
            StackExchange.ready(function () {
                $('#nav-tour').click(function () {
                    StackExchange.using("gps", function() {
                        StackExchange.gps.track("aboutpage.click", { aboutclick_location: "headermain" }, true);
                    });
                });
            });
        </script>
    </head>
    <body class="question-page">
        <noscript><div id="noscript-padding"></div></noscript>
        <div id="notify-container"></div>
        <div id="overlay-header"></div>
        <div id="custom-header"></div>
        <div class="container">
            <div id="header" class=headeranon>
                <div id="portalLink">
                    <a class="genu" href="http://stackexchange.com" onclick="StackExchange.ready(function(){genuwine.click();});return false;">Stack Exchange</a>
                </div>
                <div id="topbar">
                    <div id="hlinks">

                        <span id="hlinks-user"></span>
                        <span id="hlinks-nav">                        <a href="/users/login?returnurl=%2fquestions%2f13577041%2fphp-string-contains">sign up</a>

                            <span class="lsep">|</span>
                            <a href="/users/login?returnurl=%2fquestions%2f13577041%2fphp-string-contains">log in</a>

                            <span class="lsep">|</span>
                            <a href="http://careers.stackoverflow.com">careers 2.0</a>

                            <span class="lsep">|</span>
                        </span>
                        <span id="hlinks-custom"></span>
                    </div>
                    <div id="hsearch">
                        <form id="search" action="/search" method="get" autocomplete="off">
                            <div>
                                <input autocomplete="off" name="q" class="textbox" placeholder="search" tabindex="1" type="text" maxlength="240" size="28" value="">
                            </div>
                        </form>
                    </div>
                </div>
                <br class="cbt">
                <div id="hlogo">
                    <a href="/">
                        Stack Overflow
                    </a>
                </div>
                <div id="hmenus">
                    <div class="nav mainnavs mainnavsanon">
                        <ul>
                            <li class="youarehere"><a id="nav-questions" href="/questions">Questions</a></li>
                            <li><a id="nav-tags" href="/tags">Tags</a></li>
                            <li><a id="nav-tour" href="/about">Tour</a></li>
                            <li><a id="nav-users" href="/users">Users</a></li>
                        </ul>
                    </div>
                    <div class="nav askquestion">
                        <ul>
                            <li>
                                <a id="nav-askquestion"  href="/questions/ask">Ask Question</a>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>




            <div id="content">


                <div itemscope itemtype="http://schema.org/Article">
                    <link itemprop="image" href="//cdn.sstatic.net/stackoverflow/img/apple-touch-icon.png">
                    <!--googleoff: all-->
                    <div id="herobox-mini">
                        <div id="hero-content">
                            <span id="controls">
                                <a href="/about" id="tell-me-more" class="button">Tell me more</a>
                                <span id="close"><a title="click to dismiss">&times;</a></span>
                            </span>
                            <div id="blurb">
                                Stack Overflow is a question and answer site for professional and enthusiast programmers. It&#39;s 100% free, no registration required.
                            </div>        
                        </div>
                        <script>
                            $('#tell-me-more').click(function () {
                                var clickSource = $("body").attr("class") + '-mini';
                                if ($("body").hasClass("questions-page")) {
                                    clickSource = 'questionpagemini';
                                }
                                if ($("body").hasClass("home-page")) {
                                    clickSource = 'homepagemini';
                                }

                                StackExchange.using("gps", function () {
                                    StackExchange.gps.track("aboutpage.click", { aboutclick_location: clickSource } , true);
                                });
                            });
                            $('#herobox-mini #close').click(function () {
                                StackExchange.using("gps", function () {
                                    StackExchange.gps.track("hero.action", { hero_action_type: "close" }, true);
                                });
                                $.cookie("hero", "none", { path: "/" });
                                var $hero = $("#herobox-mini");
                                $hero.slideUp('fast', function () { $hero.remove(); });
                                return false;
                            });
                        </script>
                    </div>
                    <!--googleon: all-->
                    <div id="question-header">
                        <h1 itemprop="name"><a href="/questions/13577041/php-string-contains" class="question-hyperlink">PHP string &ldquo;contains&rdquo; [duplicate]</a></h1>
                    </div>
                    <div id="mainbar">



                        <div class="question" data-questionid="13577041"  id="question">

                            <script type="text/javascript">
                                var ados = ados || {};ados.run = ados.run || [];
                                ados.run.push(function() { ados_add_placement(22,8277,"adzerk1744683442",4).setZone(43) ; });                    
                            </script>
                            <div class="everyonelovesstackoverflow" id="adzerk1744683442">
                            </div>  


                            <table>
                                <tr>
                                    <td class="votecell">


                                        <div class="vote">
                                            <input type="hidden" name="_id_" value="13577041">
                                            <a class="vote-up-off" title="This question shows research effort; it is useful and clear">up vote</a>
                                            <span class="vote-count-post ">13</span>
                                            <a class="vote-down-off" title="This question does not show any research effort; it is unclear or not useful">down vote</a>

                                            <a class="star-off" href="#" title="This is a favorite question (click again to undo)">favorite</a>
                                            <div class="favoritecount"><b>5</b></div>   

                                        </div>

                                    </td>

                                    <td class="postcell">
                                        <div>
                                            <div class="post-text" itemprop="description">

                                                <blockquote>
                                                    <p><strong>Possible Duplicate:</strong><br>
                                                        <a href="http://stackoverflow.com/questions/1019169/how-can-i-check-if-a-word-is-contained-in-another-string-using-php">How can I check if a word is contained in another string using PHP?</a>  </p>
                                                </blockquote>



                                                <p>I know you can do this in many different ways like regex or loop through the string to see if it contains a dot (".").</p>

                                                <p>What would be the most efficient way to check whether a string contains a "." or not?</p>

                                            </div>
                                            <div class="post-taglist">
                                                <a href="/questions/tagged/php" class="post-tag" title="show questions tagged 'php'" rel="tag">php</a> <a href="/questions/tagged/string" class="post-tag" title="show questions tagged 'string'" rel="tag">string</a> 
                                            </div>
                                            <table class="fw">
                                                <tr>
                                                    <td class="vt">











                                                        <div class="post-menu"><a href="/q/13577041" title="short permalink to this question" class="short-link" id="link-post-13577041">share</a><span class="lsep">|</span><a href="/posts/13577041/edit" class="suggest-edit-post" title="">improve this question</a></div>        
                                                    </td>
                                                    <td align="right" class="post-signature">


                                                        <div class="user-info user-hover">
                                                            <div class="user-action-time">


                                                                <a href="/posts/13577041/revisions" title="show all edits to this post">edited <span title="2013-09-12 12:52:21Z" class="relativetime">Sep 12 at 12:52</span></a>
                                                            </div>
                                                            <div class="user-gravatar32">
                                                                <a href="/users/56285/jonik"><div class=""><img src="https://www.gravatar.com/avatar/0bd656eb14c50299b2744f80e69459bf?s=32&d=identicon&r=PG" alt="" width="32" height="32"></div></a>
                                                            </div>
                                                            <div class="user-details">
                                                                <a href="/users/56285/jonik">Jonik</a><br>
                                                                <span class="reputation-score" title="reputation score 13467" dir="ltr">13.5k</span><span title="11 gold badges"><span class="badge1"></span><span class="badgecount">11</span></span><span title="85 silver badges"><span class="badge2"></span><span class="badgecount">85</span></span><span title="125 bronze badges"><span class="badge3"></span><span class="badgecount">125</span></span>
                                                            </div>
                                                        </div>
                                                    </td>
                                                    <td class="post-signature owner">


                                                        <div class="user-info ">
                                                            <div class="user-action-time">


                                                                asked <span title="2012-11-27 03:40:24Z" class="relativetime">Nov 27 '12 at 3:40</span>
                                                            </div>
                                                            <div class="user-gravatar32">
                                                                <a href="/users/1686628/ealeon"><div class=""><img src="https://www.gravatar.com/avatar/1e6be8c1e7246b56b40e8d413743bfe1?s=32&d=identicon&r=PG&f=1" alt="" width="32" height="32"></div></a>
                                                            </div>
                                                            <div class="user-details">
                                                                <a href="/users/1686628/ealeon">ealeon</a><br>
                                                                <span class="reputation-score" title="reputation score" dir="ltr">826</span><span title="2 gold badges"><span class="badge1"></span><span class="badgecount">2</span></span><span title="5 silver badges"><span class="badge2"></span><span class="badgecount">5</span></span><span title="15 bronze badges"><span class="badge3"></span><span class="badgecount">15</span></span>
                                                            </div>
                                                        </div>

                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="votecell"></td>
                                    <td>
                                        <div id="comments-13577041" class="comments" data-localized="true">
                                            <table>
                                                <tbody data-remaining-comments-count="0" 
                                                       data-addlink-html="" 
                                                       data-addlink-disabled="true">

                                                    <tr id="comment-18605846" class="comment">
                                                        <td class="comment-actions">
                                                            <table>
                                                                <tbody>
                                                                    <tr>
                                                                        <td class="comment-score">

                                                                            <span title="number of &#39;useful comment&#39; votes received" 
                                                                                  class="cool">2</span>   
                                                                        </td>
                                                                        <td>
                                                                            &nbsp;
                                                                        </td>
                                                                    </tr>
                                                                </tbody>
                                                            </table>   
                                                        </td>
                                                        <td class="comment-text">

                                                            <div style="display: block;" class="comment-body">
                                                                <span class="comment-copy"><a href="http://us3.php.net/manual/en/function.strpos.php" rel="nofollow"><code>strpos()</code></a></span>
                                                                &ndash;&nbsp;
                                                                <a href="/users/541091/michael-berkowski" 
                                                                   title="114704 reputation" 
                                                                   class="comment-user">Michael Berkowski</a>
                                                                <span class="comment-date" dir="ltr"><span title="2012-11-27 03:42:47Z" class="relativetime-clean">Nov 27 '12 at 3:42</span></span>
                                                                <span class="edited-yes" title="this comment was edited 1 times"></span>
                                                            </div>

                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                        <a id="comments-link-13577041" 
                                           class="comments-link disabled-link" 
                                           title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”."></a>
                                    </td>
                                </tr>            </table>    
                        </div>
                        <div class="question-status">
                            <h2><strong>marked</strong> as duplicate by <a href="/users/541091/michael-berkowski">Michael Berkowski</a>, <a href="/users/1338292/jack">Jack</a>, <a href="/users/1427138/alessandro-minoccheri">Alessandro Minoccheri</a>, <a href="/users/11354/stefan-gehrig">Stefan Gehrig</a>, <a href="/users/898045/avasal">avasal</a> <span title="2012-11-29 08:38:18Z" class="relativetime">Nov 29 '12 at 8:38</span></h2>
                            <p> This question has been asked before and already has an answer.
                                If those answers do not fully address your question, please <a href="/questions/ask">ask a new question</a>.</p>
                        </div>


                        <div id="answers">

                            <a name="tab-top"></a>
                            <div id="answers-header">
                                <div class="subheader answers-subheader">
                                    <h2>
                                        3 Answers
                                    </h2>
                                    <div>
                                        <div id="tabs">
                                            <a href="/questions/13577041/php-string-contains?answertab=active#tab-top" title="Answers with the latest activity first">active</a>
                                            <a href="/questions/13577041/php-string-contains?answertab=oldest#tab-top" title="Answers in the order they were provided">oldest</a>
                                            <a class="youarehere" href="/questions/13577041/php-string-contains?answertab=votes#tab-top" title="Answers with the highest score first">votes</a>
                                        </div>
                                    </div>
                                </div>    
                            </div>    





                            <a name="13577070"></a>
                            <div id="answer-13577070" class="answer accepted-answer" data-answerid="13577070" >
                                <table>
                                    <tr>
                                        <td class="votecell">


                                            <div class="vote">
                                                <input type="hidden" name="_id_" value="13577070">
                                                <a class="vote-up-off" title="This answer is useful">up vote</a>
                                                <span class="vote-count-post ">48</span>
                                                <a class="vote-down-off" title="This answer is not useful">down vote</a>



                                                <span class="vote-accepted-on load-accepted-answer-date" title="loading when this answer was accepted...">accepted</span>
                                            </div>

                                        </td>



                                        <td class="answercell">
                                            <div class="post-text"><pre><code>if (strpos($str, '.') !== FALSE)
    echo 'Found it';
else
    echo "nope!";
</code></pre>

                                                <p>Note that you need to compare with the <code>!==</code> operator. If you use <code>!=</code> or <code>&lt;&gt;</code> and the <code>'.'</code> is found at position <code>0</code>, hey! <code>0</code> compares equal to <code>FALSE</code> and you lose. This will cause you to point a production website at a development database over the weekend, causing no end of joy when you return monday.</p>
                                            </div>
                                            <table class="fw">
                                                <tr>
                                                    <td class="vt">











                                                        <div class="post-menu"><a href="/a/13577070" title="short permalink to this answer" class="short-link" id="link-post-13577070">share</a><span class="lsep">|</span><a href="/posts/13577070/edit" class="suggest-edit-post" title="">improve this answer</a></div>                    </td>
                                                    <td align="right" class="post-signature">


                                                        <div class="user-info ">
                                                            <div class="user-action-time">


                                                                <a href="/posts/13577070/revisions" title="show all edits to this post">edited <span title="2012-11-27 03:49:45Z" class="relativetime">Nov 27 '12 at 3:49</span></a>
                                                            </div>
                                                            <div class="user-gravatar32">

                                                            </div>
                                                            <div class="user-details">
                                                                <br>

                                                            </div>
                                                        </div>
                                                    </td>



                                                    <td align="right" class="post-signature">   




                                                        <div class="user-info ">
                                                            <div class="user-action-time">


                                                                answered <span title="2012-11-27 03:44:29Z" class="relativetime">Nov 27 '12 at 3:44</span>
                                                            </div>
                                                            <div class="user-gravatar32">
                                                                <a href="/users/50038/akatakritos"><div class=""><img src="https://www.gravatar.com/avatar/3c007ff838f4bcd98161def2b1575f70?s=32&d=identicon&r=PG" alt="" width="32" height="32"></div></a>
                                                            </div>
                                                            <div class="user-details">
                                                                <a href="/users/50038/akatakritos">akatakritos</a><br>
                                                                <span class="reputation-score" title="reputation score" dir="ltr">3,177</span><span title="8 silver badges"><span class="badge2"></span><span class="badgecount">8</span></span><span title="20 bronze badges"><span class="badge3"></span><span class="badgecount">20</span></span>
                                                            </div>
                                                        </div>

                                                    </td>
                                                </tr>
                                            </table>
                                        </td>        </tr>

                                    <tr>
                                        <td class="votecell"></td>
                                        <td>
                                            <div id="comments-13577070" class="comments" data-localized="true">
                                                <table>
                                                    <tbody data-remaining-comments-count="0" 
                                                           data-addlink-html="" 
                                                           data-addlink-disabled="true">

                                                        <tr id="comment-18605976" class="comment">
                                                            <td>
                                                                <table>
                                                                    <tbody>
                                                                        <tr>
                                                                            <td class="comment-score">

                                                                            </td>
                                                                            <td>
                                                                                &nbsp;
                                                                            </td>
                                                                        </tr>
                                                                    </tbody>
                                                                </table>   
                                                            </td>
                                                            <td class="comment-text">

                                                                <div style="display: block;" class="comment-body">
                                                                    <span class="comment-copy">this works as needed. thanks</span>
                                                                    &ndash;&nbsp;
                                                                    <a href="/users/1686628/ealeon" 
                                                                       title="826 reputation" 
                                                                       class="comment-user owner">ealeon</a>
                                                                    <span class="comment-date" dir="ltr"><span title="2012-11-27 03:51:33Z" class="relativetime-clean">Nov 27 '12 at 3:51</span></span>
                                                                </div>

                                                            </td>
                                                        </tr>
                                                        <tr id="comment-25103107" class="comment">
                                                            <td class="comment-actions">
                                                                <table>
                                                                    <tbody>
                                                                        <tr>
                                                                            <td class="comment-score">

                                                                                <span title="number of &#39;useful comment&#39; votes received" 
                                                                                      class="cool">1</span>   
                                                                            </td>
                                                                            <td>
                                                                                &nbsp;
                                                                            </td>
                                                                        </tr>
                                                                    </tbody>
                                                                </table>   
                                                            </td>
                                                            <td class="comment-text">

                                                                <div style="display: block;" class="comment-body">
                                                                    <span class="comment-copy">+1 for &quot;This will cause you to point a production website at a development database over the weekend, causing no end of joy when you return monday.&quot;</span>
                                                                    &ndash;&nbsp;
                                                                    <a href="/users/568884/jordan-arseno" 
                                                                       title="3521 reputation" 
                                                                       class="comment-user">Jordan Arseno</a>
                                                                    <span class="comment-date" dir="ltr"><span title="2013-06-25 23:07:11Z" class="relativetime-clean">Jun 25 at 23:07</span></span>
                                                                </div>

                                                            </td>
                                                        </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                            <a id="comments-link-13577070" 
                                               class="comments-link disabled-link" 
                                               title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”."></a>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <script type="text/javascript">
                                var ados = ados || {};ados.run = ados.run || [];
                                ados.run.push(function() { ados_add_placement(22,8277,"adzerk1540342715",4).setZone(44) ; });                    
                            </script>
                            <div class="everyonelovesstackoverflow" id="adzerk1540342715">
                            </div>  




                            <a name="13577071"></a>
                            <div id="answer-13577071" class="answer" data-answerid="13577071" >
                                <table>
                                    <tr>
                                        <td class="votecell">


                                            <div class="vote">
                                                <input type="hidden" name="_id_" value="13577071">
                                                <a class="vote-up-off" title="This answer is useful">up vote</a>
                                                <span class="vote-count-post ">10</span>
                                                <a class="vote-down-off" title="This answer is not useful">down vote</a>



                                            </div>

                                        </td>



                                        <td class="answercell">
                                            <div class="post-text"><p>You can use these string functions,</p>

                                                <p><a href="http://www.php.net/manual/en/function.strstr.php">strstr</a> — Find the first occurrence of a string</p>

                                                <p><a href="http://www.php.net/manual/en/function.stristr.php">stristr</a> — Case-insensitive strstr()</p>

                                                <p><a href="http://www.php.net/manual/en/function.strrchr.php">strrchr</a> — Find the last occurrence of a character in a string</p>

                                                <p><a href="http://www.php.net/manual/en/function.strpos.php">strpos</a> — Find the position of the first occurrence of a substring in a string</p>

                                                <p><a href="http://www.php.net/manual/en/function.strpbrk.php">strpbrk</a> — Search a string for any of a set of characters</p>

                                                <p>If that doesn't help then you should use <code>preg</code> regular expression</p>

                                                <p><a href="http://www.php.net/manual/en/function.preg-match.php">preg_match</a> — Perform a regular expression match</p>
                                            </div>
                                            <table class="fw">
                                                <tr>
                                                    <td class="vt">











                                                        <div class="post-menu"><a href="/a/13577071" title="short permalink to this answer" class="short-link" id="link-post-13577071">share</a><span class="lsep">|</span><a href="/posts/13577071/edit" class="suggest-edit-post" title="">improve this answer</a></div>                    </td>



                                                    <td align="right" class="post-signature">   




                                                        <div class="user-info user-hover">
                                                            <div class="user-action-time">


                                                                answered <span title="2012-11-27 03:44:36Z" class="relativetime">Nov 27 '12 at 3:44</span>
                                                            </div>
                                                            <div class="user-gravatar32">
                                                                <a href="/users/615746/muthu-kumaran"><div class=""><img src="https://www.gravatar.com/avatar/33272994099e7687f30d5af7a604632e?s=32&d=identicon&r=PG" alt="" width="32" height="32"></div></a>
                                                            </div>
                                                            <div class="user-details">
                                                                <a href="/users/615746/muthu-kumaran">Muthu Kumaran</a><br>
                                                                <span class="reputation-score" title="reputation score" dir="ltr">5,303</span><span title="1 gold badge"><span class="badge1"></span><span class="badgecount">1</span></span><span title="11 silver badges"><span class="badge2"></span><span class="badgecount">11</span></span><span title="30 bronze badges"><span class="badge3"></span><span class="badgecount">30</span></span>
                                                            </div>
                                                        </div>

                                                    </td>
                                                </tr>
                                            </table>
                                        </td>        </tr>

                                    <tr>
                                        <td class="votecell"></td>
                                        <td>
                                            <div id="comments-13577071" class="comments" data-localized="true">
                                                <table>
                                                    <tbody data-remaining-comments-count="0" 
                                                           data-addlink-html="" 
                                                           data-addlink-disabled="true">

                                                        <tr id="comment-18605999" class="comment">
                                                            <td>
                                                                <table>
                                                                    <tbody>
                                                                        <tr>
                                                                            <td class="comment-score">

                                                                            </td>
                                                                            <td>
                                                                                &nbsp;
                                                                            </td>
                                                                        </tr>
                                                                    </tbody>
                                                                </table>   
                                                            </td>
                                                            <td class="comment-text">

                                                                <div style="display: block;" class="comment-body">
                                                                    <span class="comment-copy">very informative. i will keep these functions in mind. thank you!</span>
                                                                    &ndash;&nbsp;
                                                                    <a href="/users/1686628/ealeon" 
                                                                       title="826 reputation" 
                                                                       class="comment-user owner">ealeon</a>
                                                                    <span class="comment-date" dir="ltr"><span title="2012-11-27 03:52:47Z" class="relativetime-clean">Nov 27 '12 at 3:52</span></span>
                                                                </div>

                                                            </td>
                                                        </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                            <a id="comments-link-13577071" 
                                               class="comments-link disabled-link" 
                                               title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”."></a>
                                        </td>
                                    </tr>
                                </table>
                            </div>


                            <a name="13577090"></a>
                            <div id="answer-13577090" class="answer" data-answerid="13577090" >
                                <table>
                                    <tr>
                                        <td class="votecell">


                                            <div class="vote">
                                                <input type="hidden" name="_id_" value="13577090">
                                                <a class="vote-up-off" title="This answer is useful">up vote</a>
                                                <span class="vote-count-post ">1</span>
                                                <a class="vote-down-off" title="This answer is not useful">down vote</a>



                                            </div>

                                        </td>



                                        <td class="answercell">
                                            <div class="post-text"><p>You can use  stristr () or strpos(). Both return false if nothing is found.</p>
                                            </div>
                                            <table class="fw">
                                                <tr>
                                                    <td class="vt">











                                                        <div class="post-menu"><a href="/a/13577090" title="short permalink to this answer" class="short-link" id="link-post-13577090">share</a><span class="lsep">|</span><a href="/posts/13577090/edit" class="suggest-edit-post" title="">improve this answer</a></div>                    </td>



                                                    <td align="right" class="post-signature">   




                                                        <div class="user-info ">
                                                            <div class="user-action-time">


                                                                answered <span title="2012-11-27 03:46:25Z" class="relativetime">Nov 27 '12 at 3:46</span>
                                                            </div>
                                                            <div class="user-gravatar32">
                                                                <a href="/users/61905/sylverdrag"><div class=""><img src="https://www.gravatar.com/avatar/8fd61ba486a09ad5274dd70f1a1737f6?s=32&d=identicon&r=PG" alt="" width="32" height="32"></div></a>
                                                            </div>
                                                            <div class="user-details">
                                                                <a href="/users/61905/sylverdrag">Sylverdrag</a><br>
                                                                <span class="reputation-score" title="reputation score" dir="ltr">2,965</span><span title="3 gold badges"><span class="badge1"></span><span class="badgecount">3</span></span><span title="15 silver badges"><span class="badge2"></span><span class="badgecount">15</span></span><span title="23 bronze badges"><span class="badge3"></span><span class="badgecount">23</span></span>
                                                            </div>
                                                        </div>

                                                    </td>
                                                </tr>
                                            </table>
                                        </td>        </tr>

                                    <tr>
                                        <td class="votecell"></td>
                                        <td>
                                            <div id="comments-13577090" class="comments dno" data-localized="true">
                                                <table>
                                                    <tbody data-remaining-comments-count="0" 
                                                           data-addlink-html="" 
                                                           data-addlink-disabled="true">
                                                        <tr><td></td><td></td></tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                            <a id="comments-link-13577090" 
                                               class="comments-link disabled-link" 
                                               title="Use comments to ask for more information or suggest improvements. Avoid comments like “+1” or “thanks”."></a>
                                        </td>
                                    </tr>
                                </table>
                            </div>



                            <h2 class="bottom-notice">
                                Not the answer you&#39;re looking for?							Browse other questions tagged <a href="/questions/tagged/php" class="post-tag" title="show questions tagged 'php'" rel="tag">php</a> <a href="/questions/tagged/string" class="post-tag" title="show questions tagged 'string'" rel="tag">string</a>  or <a href="/questions/ask">ask your own question</a>.						</h2>
                        </div>
                    </div>
                    <div id="sidebar" class="show-votes">
                        <div class="module question-stats">
                            <p class="label-key">tagged</p>
                            <div class="tagged"><a href="/questions/tagged/php" class="post-tag" title="show questions tagged 'php'" rel="tag">php</a>&nbsp;<span class="item-multiplier"><span class="item-multiplier-x">&times;</span>&nbsp;<span class="item-multiplier-count">457224</span></span><br>
                                <a href="/questions/tagged/string" class="post-tag" title="show questions tagged 'string'" rel="tag">string</a>&nbsp;<span class="item-multiplier"><span class="item-multiplier-x">&times;</span>&nbsp;<span class="item-multiplier-count">46356</span></span><br>
                            </div>
                            <table id="qinfo">
                                <tr>
                                    <td>
                                        <p class="label-key">asked</p>
                                    </td>
                                    <td style="padding-left: 10px">
                                        <p class="label-key" title="2012-11-27 03:40:24Z"><b>10 months ago</b></p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <p class="label-key">viewed</p>
                                    </td>

                                    <td style="padding-left: 10px">
                                        <p class="label-key">
                                            <b>33294 times</b>
                                        </p>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <p class="label-key">active</p>
                                    </td>
                                    <td style="padding-left: 10px">
                                        <p class="label-key"><b><a href="?lastactivity" class="lastactivity-link" title="2013-09-12 12:52:21Z">1 month ago</a></b></p>
                                    </td>
                                </tr>
                            </table>
                        </div>

                        <script type="text/javascript">
                            var ados = ados || {};ados.run = ados.run || [];
                            ados.run.push(function() { ados_add_placement(22,8277,"adzerk1348675349",17).setZone(45) ; });                    
                        </script>
                        <div class="everyonelovesstackoverflow" id="adzerk1348675349">
                        </div>  
                        <div id="hireme">
                            <script type="text/javascript">
                                window.careers_adurl="http://careers.stackoverflow.com/gethired/js",window.careers_cssurl="//cdn-careers.sstatic.net/careers/gethired/sidebar.min.css?v=7ae83073b37e",window.careers_leaderboardcssurl="//cdn-careers.sstatic.net/careers/gethired/ninja.min.css?v=78ccbfa5c59f",window.careers_companycssurl="//cdn-careers.sstatic.net/careers/gethired/company",window.careers_adselector="div.hireme, div#hireme",StackExchange.ready(function(){$.ajax({url:"//cdn-careers.sstatic.net/careers/gethired/loader.min.js?v=607ab2dda910",dataType:"script",cache:!0})})        </script>
                        </div>





                        <div class="module sidebar-linked">
                            <h4 id="h-linked">Linked</h4>
                            <div class="linked" data-tracker="lq=1">
                                <div class="spacer">
                                    <a href="/q/1019169" title="Vote score (upvotes - downvotes)">
                                        <div class="answer-votes answered-accepted default">14</div>
                                    </a>
                                    <a href="/questions/1019169/how-can-i-check-if-a-word-is-contained-in-another-string-using-php" class="question-hyperlink">How can I check if a word is contained in another string using PHP?</a>
                                </div>			</div>
                        </div>


                        <div class="module sidebar-related">
                            <h4 id="h-related">Related</h4>
                            <div class="related" data-tracker="rq=1">
                                <div class="spacer">
                                    <a href="/q/7074" title="Vote score (upvotes - downvotes)">
                                        <div class="answer-votes answered-accepted extra-large">1156</div>
                                    </a>
                                    <a href="/questions/7074/whats-the-difference-between-string-and-string" class="question-hyperlink">What&#39;s the difference between String and string?</a>
                                </div>
                                <div class="spacer">
                                    <a href="/q/309424" title="Vote score (upvotes - downvotes)">
                                        <div class="answer-votes answered-accepted large">861</div>
                                    </a>
                                    <a href="/questions/309424/read-convert-an-inputstream-to-a-string" class="question-hyperlink">Read/convert an InputStream to a String</a>
                                </div>
                                <div class="spacer">
                                    <a href="/q/834303" title="Vote score (upvotes - downvotes)">
                                        <div class="answer-votes answered-accepted large">356</div>
                                    </a>
                                    <a href="/questions/834303/php-startswith-and-endswith-functions" class="question-hyperlink">PHP startsWith() and endsWith() functions</a>
                                </div>
                                <div class="spacer">
                                    <a href="/q/1789945" title="Vote score (upvotes - downvotes)">
                                        <div class="answer-votes answered-accepted extra-large">1486</div>
                                    </a>
                                    <a href="/questions/1789945/how-can-i-check-if-one-string-contains-another-substring-in-javascript" class="question-hyperlink">How can I check if one string contains another substring in JavaScript?</a>
                                </div>
                                <div class="spacer">
                                    <a href="/q/2352779" title="Vote score (upvotes - downvotes)">
                                        <div class="answer-votes answered-accepted default">8</div>
                                    </a>
                                    <a href="/questions/2352779/if-string-only-contains-spaces" class="question-hyperlink">If string only contains spaces?</a>
                                </div>
                                <div class="spacer">
                                    <a href="/q/2753956" title="Vote score (upvotes - downvotes)">
                                        <div class="answer-votes answered-accepted large">363</div>
                                    </a>
                                    <a href="/questions/2753956/string-contains-string-in-objective-c" class="question-hyperlink">String contains string in objective-c</a>
                                </div>
                                <div class="spacer">
                                    <a href="/q/9627898" title="Vote score (upvotes - downvotes)">
                                        <div class="answer-votes answered-accepted default">0</div>
                                    </a>
                                    <a href="/questions/9627898/php-string-contains-and-incorrectly-recognizes-variable" class="question-hyperlink">PHP string contains $ and incorrectly recognizes variable</a>
                                </div>
                                <div class="spacer">
                                    <a href="/q/11138882" title="Vote score (upvotes - downvotes)">
                                        <div class="answer-votes default">0</div>
                                    </a>
                                    <a href="/questions/11138882/check-if-string-contains-a-string-in-php" class="question-hyperlink">Check if string contains a string in PHP</a>
                                </div>
                                <div class="spacer">
                                    <a href="/q/15376516" title="Vote score (upvotes - downvotes)">
                                        <div class="answer-votes default">-2</div>
                                    </a>
                                    <a href="/questions/15376516/php-check-if-column-contains-a-string" class="question-hyperlink">PHP - Check if column contains a string?</a>
                                </div>
                                <div class="spacer">
                                    <a href="/q/17385506" title="Vote score (upvotes - downvotes)">
                                        <div class="answer-votes answered-accepted default">0</div>
                                    </a>
                                    <a href="/questions/17385506/php-if-a-string-contain-two-different-characters" class="question-hyperlink">php if a string contain two different characters</a>
                                </div>

                            </div>
                        </div>
                    </div>
                    <script type="text/javascript">
                        StackExchange.ready(function(){$.get('/posts/13577041/ivc/6afd');});
                    </script>
                    <noscript>
                    <div><img src="/posts/13577041/ivc/6afd" class="dno" alt="" width="0" height="0"></div>
                    </noscript><div style="display:none" id="prettify-lang">lang-php</div></div>


            </div>
        </div>
        <div id="footer" class="categories">
            <div class="footerwrap">
                <div id="footer-menu">
                    <div class="top-footer-links">
                        <a href="/about">about</a>
                        <a href="/help">help</a>
                        <a href="/help/badges">badges</a>
                        <a href="http://blog.stackexchange.com?blb=1">blog</a>
                        <a href="http://chat.stackoverflow.com">chat</a>
                        <a href="http://data.stackexchange.com">data</a>
                        <a href="http://stackexchange.com/legal">legal</a>
                        <a href="http://stackexchange.com/legal/privacy-policy">privacy policy</a>
                        <a href="http://stackexchange.com/about/hiring">jobs</a>
                        <a href="http://engine.adzerk.net/r?e=eyJhdiI6NDE0LCJhdCI6MjAsImNtIjo5NTQsImNoIjoxMTc4LCJjciI6Mjc3NiwiZG0iOjQsImZjIjoyODYyLCJmbCI6Mjc1MSwibnciOjIyLCJydiI6MCwicHIiOjExNSwic3QiOjAsInVyIjoiaHR0cDovL3N0YWNrb3ZlcmZsb3cuY29tL2Fib3V0L2NvbnRhY3QiLCJyZSI6MX0&amp;s=hRods5B22XvRBwWIwtIMekcyNF8">advertising info</a>

                        <a onclick='StackExchange.switchMobile("on", "/questions/13577041/php-string-contains")'>mobile</a>
                        <b><a href="/contact">contact us</a></b>
                        <b><a href="http://meta.stackoverflow.com">feedback</a></b>

                    </div>
                    <div id="footer-sites">
                        <table>
                            <tr>
                                <th colspan=3>
                                    Technology
                                </th>
                                <th >
                                    Life / Arts
                                </th>
                                <th >
                                    Culture / Recreation
                                </th>
                                <th >
                                    Science
                                </th>
                                <th >
                                    Other
                                </th>
                            </tr>
                            <tr>
                                <td>
                                    <ol>
                                        <li><a href="http://stackoverflow.com" title="professional and enthusiast programmers">Stack Overflow</a></li>
                                        <li><a href="http://serverfault.com" title="professional system and network administrators">Server Fault</a></li>
                                        <li><a href="http://superuser.com" title="computer enthusiasts and power users">Super User</a></li>
                                        <li><a href="http://webapps.stackexchange.com" title="power users of web applications">Web Applications</a></li>
                                        <li><a href="http://askubuntu.com" title="Ubuntu users and developers">Ask Ubuntu</a></li>
                                        <li><a href="http://webmasters.stackexchange.com" title="pro webmasters">Webmasters</a></li>
                                        <li><a href="http://gamedev.stackexchange.com" title="professional and independent game developers">Game Development</a></li>
                                        <li><a href="http://tex.stackexchange.com" title="users of TeX, LaTeX, ConTeXt, and related typesetting systems">TeX - LaTeX</a></li>
                                    </ol></td><td><ol>
                                        <li><a href="http://programmers.stackexchange.com" title="professional programmers interested in conceptual questions about software development">Programmers</a></li>
                                        <li><a href="http://unix.stackexchange.com" title="users of Linux, FreeBSD and other Un*x-like operating systems.">Unix &amp; Linux</a></li>
                                        <li><a href="http://apple.stackexchange.com" title="power users of Apple hardware and software">Ask Different (Apple)</a></li>
                                        <li><a href="http://wordpress.stackexchange.com" title="WordPress developers and administrators">WordPress Answers</a></li>
                                        <li><a href="http://gis.stackexchange.com" title="cartographers, geographers and GIS professionals">Geographic Information Systems</a></li>
                                        <li><a href="http://electronics.stackexchange.com" title="electronics and electrical engineering professionals, students, and enthusiasts">Electrical Engineering</a></li>
                                        <li><a href="http://android.stackexchange.com" title="enthusiasts and power users of the Android operating system">Android Enthusiasts</a></li>
                                        <li><a href="http://security.stackexchange.com" title="Information security professionals">Information Security</a></li>
                                    </ol></td><td><ol>
                                        <li><a href="http://dba.stackexchange.com" title="database professionals who wish to improve their database skills and learn from others in the community">Database Administrators</a></li>
                                        <li><a href="http://drupal.stackexchange.com" title="Drupal developers and administrators">Drupal Answers</a></li>
                                        <li><a href="http://sharepoint.stackexchange.com" title="SharePoint enthusiasts">SharePoint</a></li>
                                        <li><a href="http://ux.stackexchange.com" title="user experience researchers and experts">User Experience</a></li>
                                        <li><a href="http://mathematica.stackexchange.com" title="users of Mathematica">Mathematica</a></li>

                                        <li>
                                            <a href="http://stackexchange.com/sites#technology" class="more">
                                                more (13)
                                            </a>
                                        </li>
                                    </ol>
                                </td>
                                <td>
                                    <ol>
                                        <li><a href="http://photo.stackexchange.com" title="professional, enthusiast and amateur photographers">Photography</a></li>
                                        <li><a href="http://scifi.stackexchange.com" title="science fiction and fantasy enthusiasts">Science Fiction &amp; Fantasy</a></li>
                                        <li><a href="http://cooking.stackexchange.com" title="professional and amateur chefs">Seasoned Advice (cooking)</a></li>
                                        <li><a href="http://diy.stackexchange.com" title="contractors and serious DIYers">Home Improvement</a></li>

                                        <li>
                                            <a href="http://stackexchange.com/sites#lifearts" class="more">
                                                more (13)
                                            </a>
                                        </li>
                                    </ol>
                                </td>
                                <td>
                                    <ol>
                                        <li><a href="http://english.stackexchange.com" title="linguists, etymologists, and serious English language enthusiasts">English Language &amp; Usage</a></li>
                                        <li><a href="http://skeptics.stackexchange.com" title="scientific skepticism">Skeptics</a></li>
                                        <li><a href="http://judaism.stackexchange.com" title="those who base their lives on Jewish law and tradition and anyone interested in learning more">Mi Yodeya (Judaism)</a></li>
                                        <li><a href="http://travel.stackexchange.com" title="road warriors and seasoned travelers">Travel</a></li>
                                        <li><a href="http://christianity.stackexchange.com" title="committed Christians, experts in Christianity and those interested in learning more">Christianity</a></li>
                                        <li><a href="http://gaming.stackexchange.com" title="passionate videogamers on all platforms">Arqade (gaming)</a></li>
                                        <li><a href="http://bicycles.stackexchange.com" title="people who build and repair bicycles, people who train cycling, or commute on bicycles">Bicycles</a></li>
                                        <li><a href="http://rpg.stackexchange.com" title="gamemasters and players of tabletop, paper-and-pencil role-playing games">Role-playing Games</a></li>

                                        <li>
                                            <a href="http://stackexchange.com/sites#culturerecreation" class="more">
                                                more (21)
                                            </a>
                                        </li>
                                    </ol>
                                </td>
                                <td>
                                    <ol>
                                        <li><a href="http://math.stackexchange.com" title="people studying math at any level and professionals in related fields">Mathematics</a></li>
                                        <li><a href="http://stats.stackexchange.com" title="statisticians, data analysts, data miners and data visualization experts">Cross Validated (stats)</a></li>
                                        <li><a href="http://cstheory.stackexchange.com" title="theoretical computer scientists and researchers in related fields">Theoretical Computer Science</a></li>
                                        <li><a href="http://physics.stackexchange.com" title="active researchers, academics and students of physics">Physics</a></li>
                                        <li><a href="http://mathoverflow.net" title="professional mathematicians">MathOverflow</a></li>

                                        <li>
                                            <a href="http://stackexchange.com/sites#science" class="more">
                                                more (7)
                                            </a>
                                        </li>
                                    </ol>
                                </td>
                                <td>
                                    <ol>
                                        <li><a href="http://stackapps.com" title="apps, scripts, and development with the Stack Exchange API">Stack Apps</a></li>
                                        <li><a href="http://meta.stackoverflow.com" title="meta-discussion of the Stack Exchange family of Q&amp;A websites">Meta Stack Overflow</a></li>
                                        <li><a href="http://area51.stackexchange.com" title="proposing new sites in the Stack Exchange network">Area 51</a></li>
                                        <li><a href="http://careers.stackoverflow.com">Stack Overflow Careers</a></li>

                                    </ol>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>

                <div id="copyright">
                    site design / logo &#169; 2013 stack exchange inc; user contributions licensed under <a href="http://creativecommons.org/licenses/by-sa/3.0/" rel="license">cc-wiki</a> 
                    with <a href="http://blog.stackoverflow.com/2009/06/attribution-required/" rel="license">attribution required</a>
                </div>
                <div id="footer-flair">
                    <a href="http://creativecommons.org/licenses/by-sa/3.0/" class="cc-wiki-link"></a>
                </div>
                <div id="svnrev">
                    rev 2013.10.17.1075
                </div>

            </div>
        </div>
        <noscript>
        <div id="noscript-warning">Stack Overflow works best with JavaScript enabled<img src="http://pixel.quantserve.com/pixel/p-c1rF4kxgLUzNc.gif" alt="" class="dno"></div>
        </noscript>
        <script type="text/javascript">var p = "http", d = "static"; if (document.location.protocol == "https:") { p += "s"; d = "engine"; } var z = document.createElement("script"); z.type = "text/javascript"; z.async = true; z.src = p + "://" + d + ".adzerk.net/ados.js"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(z, s);</script>
        <script type="text/javascript">
            var ados = ados || {};
            ados.run = ados.run || [];
            ados.run.push(function () { ados_setKeywords('php,string');; ados_load(); });         
        </script>

        <script type="text/javascript">var _gaq=_gaq||[];_gaq.push(['_setAccount','UA-5620270-1']);
            _gaq.push(['_setCustomVar', 1, 'tags', '|php|string|']); 
            _gaq.push(['_trackPageview']);
            var _qevents = _qevents || [];
            (function () {
                var ssl='https:'==document.location.protocol,
                s=document.getElementsByTagName('script')[0],
                ga=document.createElement('script');
                ga.type='text/javascript';
                ga.async=true;
                ga.src=(ssl?'https://ssl':'http://www')+'.google-analytics.com/ga.js';
                s.parentNode.insertBefore(ga,s);
                var sc=document.createElement('script');
                sc.type='text/javascript';
                sc.async=true;
                sc.src=(ssl?'https://secure':'http://edge')+'.quantserve.com/quant.js';
                s.parentNode.insertBefore(sc,s);
            })();
            _qevents.push({ qacct: "p-c1rF4kxgLUzNc" });
        </script>        

    </body>
</html>